/****************************************Copyright (c)**************************************************
**                                         2016-03
**
**                                
**
**
**--------------File Info-------------------------------------------------------------------------------
** File name:		    ht6x1x_exint.h
** Last modified Date:  2016-03-29
** Last Version:		v1.0
** Descriptions:		
**
**------------------------------------------------------------------------------------------------------
** Created by:			Evan Chen
** Created date:		2016-03-29
** Version:				v1.0
** Descriptions:		
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HT6X1X_EXINT_H
#define __HT6X1X_EXINT_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "ht60xx.h"

typedef enum
{ 
	EXTIE_INT0 = 0x0001,
	EXTIE_INT1 = 0x0002,
	EXTIE_INT2 = 0x0004,
	EXTIE_INT3 = 0x0008,
	EXTIE_INT4 = 0x0010,
	EXTIE_INT5 = 0x0020,
	EXTIE_INT6 = 0x0040,
}EXT_EdgePins;

typedef enum
{
	EXTIE_EdgeRaise = 8,
	EXTIE_EdgeFall = 0,
}EXT_EdgeType;

/*EXTIE*/
#define EXTIE_RIE_MASK       		((uint16_t)0x7F00)
#define EXTIE_FIE_MASK       		((uint16_t)0x007F)

/*EXTIF*/
#define EXTIF_RIE_MASK       		((uint16_t)0x7F00)
#define EXTIF_FIE_MASK       		((uint16_t)0x007F)

typedef enum
{ 
	EXTFLT_INT0 = 0x0001,
	EXTFLT_INT1 = 0x0002,
	EXTFLT_INT2 = 0x0004,
	EXTFLT_INT3 = 0x0008,
	EXTFLT_INT4 = 0x0010,
	EXTFLT_INT5 = 0x0020,
	EXTFLT_INT6 = 0x0040,
	EXTFLT_RX0 = 0x0100,
	EXTFLT_RX1 = 0x0200,
	EXTFLT_RX2 = 0x0400,
	EXTFLT_RX3 = 0x0800,
	EXTFLT_RX4 = 0x1000,
	EXTFLT_RX5 = 0x2000,
	EXTFLT_ALL = 0x3F7F
}EXT_FilterPins;

/*PINFLT*/
#define PINFLT_RIE_MASK       	((uint16_t)0x3F00)
#define PINFLT_FIE_MASK       		((uint16_t)0x007F)

void EXINT_Enable(EXT_EdgePins pin, EXT_EdgeType edge);
void EXINT_Disable(EXT_EdgePins pin, EXT_EdgeType edge);
void EXINT_ClearFlag(void);
void EXINT_SetPinFilter(EXT_FilterPins pin, FunctionalState state);

#ifdef __cplusplus
}
#endif

#endif /* __HT6X1X_EXINT_H */

